-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

=============================================================================
FreeBSD-EN-19:05.kqueue                                         Errata Notice
                                                          The FreeBSD Project

Topic:          kqueue race condition and kernel panic

Category:       core
Module:         kqueue
Announced:      2019-01-09
Credits:        Mark Johnston
Affects:        FreeBSD 11.2
Corrected:      2018-11-24 17:11:47 UTC (stable/11, 11.2-STABLE)
                2019-01-09 18:57:38 UTC (releng/11.2, 11.2-RELEASE-p8)

For general information regarding FreeBSD Errata Notices and Security
Advisories, including descriptions of the fields above, security
branches, and the following sections, please visit
<URL:https://security.FreeBSD.org/>.

I.   Background

kevent(2) is a system call which provides a generic method of notifying the
caller when a caller-specified event happens or a condition holds.  One use
for kevent(2) is to wait for a specified timeout to elapse.

II.  Problem Description

The kevent(2) implementation in the kernel contains a race condition which
can be triggered when an event is added and fires shortly after.  Most event
types are not affected, but timer events can trigger the race if the timeout
duration is very short.

III. Impact

The race condition can cause corruption of a queue structure, leading to
a kernel panic when it is later accessed.  Applications using kevent(2) may
trigger the panic if their usage causes the race condition to occur.

IV.  Workaround

No workaround is available.

V.   Solution

Perform one of the following:

1) Upgrade your system to a supported FreeBSD stable or release / security
branch (releng) dated after the correction date, and reboot.

2) To update your system via a binary patch:

Systems running a RELEASE version of FreeBSD on the i386 or amd64
platforms can be updated via the freebsd-update(8) utility:

# freebsd-update fetch
# freebsd-update install
# shutdown -r +30 "Rebooting for errata update"

3) To update your system via a source code patch:

The following patches have been verified to apply to the applicable
FreeBSD release branches.

a) Download the relevant patch from the location below, and verify the
detached PGP signature using your PGP utility.

[FreeBSD 11.2]
# fetch https://security.FreeBSD.org/patches/EN-19:05/kqueue.patch
# fetch https://security.FreeBSD.org/patches/EN-19:05/kqueue.patch.asc
# gpg --verify kqueue.patch.asc

b) Apply the patch.  Execute the following commands as root:

# cd /usr/src
# patch < /path/to/patch

c) Recompile your kernel as described in
<URL:https://www.FreeBSD.org/handbook/kernelconfig.html> and reboot the
system.

VI.  Correction details

The following list contains the correction revision numbers for each
affected branch.

Branch/path                                                      Revision
- -------------------------------------------------------------------------
stable/11/                                                        r340904
releng/11.2/                                                      r342899
- -------------------------------------------------------------------------

To see which files were modified by a particular revision, run the
following command, replacing NNNNNN with the revision number, on a
machine with Subversion installed:

# svn diff -cNNNNNN --summarize svn://svn.freebsd.org/base

Or visit the following URL, replacing NNNNNN with the revision number:

<URL:https://svnweb.freebsd.org/base?view=revision&revision=NNNNNN>

VII. References

The latest revision of this advisory is available at
<URL:https://security.FreeBSD.org/advisories/FreeBSD-EN-19:05.kqueue.asc>
-----BEGIN PGP SIGNATURE-----

iQKTBAEBCgB9FiEE/A6HiuWv54gCjWNV05eS9J6n5cIFAlw2VMNfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEZD
MEU4NzhBRTVBRkU3ODgwMjhENjM1NUQzOTc5MkY0OUVBN0U1QzIACgkQ05eS9J6n
5cKd6w//TosPdyuAk6CprourETJqeCI8IfeBcErPs1gAXhSw53Qiv0p6vQoPRUK3
Hy9JjI5+OonvN178ebWMGDuVr5Q6LrFbn1/ZB9/RSwfKnCGAkKqvAxz/fGypwjLn
BDAY3y+opIaLGxxSK9pVdfEqiWtfwsbvQIDLcrFNDdndASWE2vsTJsviQ5jqb/kQ
oja8cAidKy4g2E+afUD7QAQHISNkxmNTQ1ahYnf3XsLIJVllWIIU9h5rH5JhiUpp
A7ZK2ryCQLbgee98UtfMD56cb4tA4sVwomHv6US/U2exUfKDfWQur5g8XYkAoXJ/
Pn0HfH1ojbMlzqzuiwAmtRvJKP1AjAlpIZXv1Co30yEMTaT3lEilNiQyibYXnYQa
FBCrwyFVxBdQnznNYtHdiM+prQ06j8f76AXoRUt/K/cRLaTtUdTagBVc+Byz9WE4
2tcVSyx54nP3NRaL6Yp/CuaIhpr68AUvSiU+nJhB9F3oC9TToBjCdm+CAnjvnZVq
OF6whswr8KHAdw48aRACgW9FpnCWGE78R4B9TnISae98KyaLPrsFGoSd4mBEWRYK
eZQWQg92bq8LIfElUW7Pc30Tp5l8GbCaHcyLuzGkBNWCIkQ24ugIay4ZfNoknYQL
CIvp8JUNy3hd9ROGHouyUjPgoBQNIQ1WUlgUZxjglMY2jP/LF/Y=
=htJA
-----END PGP SIGNATURE-----
